home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / XPK / Source / Include / SDI_defines.h < prev   
Encoding:
C/C++ Source or Header  |  1997-05-31  |  3.9 KB  |  139 lines

  1. #ifndef SDI_DEFINES_H
  2. #define SDI_DEFINES_H
  3.  
  4. /* Includeheader
  5.  
  6.     Name:        SDI_defines
  7.     Versionstring:    $VER: SDI_defines.h 1.24 (17.03.97)
  8.     Author:        SDI
  9.     Distribution:    PD
  10.     Description:    standard defines and macros and version string
  11.  
  12.  1.0    : created with help of ...SDI.h files
  13.  1.1    : SDI_ERROR added
  14.  1.2    : made INFO's better
  15.  1.3    : removed SDI_ERROR
  16.  1.4    : INFO_ERR corrected
  17.  1.5    : when DATE not defined, then DATE == __DATE2__ (Maxon C++)
  18.  1.6    : introduced DEBUG parts
  19.  1.7    : changed DEBUG's a bit
  20.  1.8    : OS_VERSION and TEST_OS added
  21.  1.9   10.08.95 : made OS_VERSION shorter
  22.  1.10  18.08.95 : DEBUG_BREAKS added
  23.  1.11  23.09.95 : NOVERSION added
  24.  1.12  15.10.95 : now STRPTR version
  25.  1.13  05.02.96 : isprintSDI, isHEXNum removed
  26.  1.14  13.04.96 : version string moved into header
  27.  1.15  28.05.96 : added ENDCODE
  28.  1.16  05.06.96 : Protos for End and extern definition for version also
  29.      without defines, except with NOCODE define, TEST_OS, OS_VERSION
  30.      removed
  31.  1.17  12.06.96 : RETURN_WARN instead of RETURN_ERROR in ENDCODE
  32.  1.18  06.07.96 : ENDCODE: PrintFault behind end --> allows selecting output
  33.  1.19  21.08.96 : added __SASC __AMIGADATE__ support
  34.  1.20  24.08.96 : better SAS-C support
  35.  1.21  04.09.96 : changed error with SAS date having the brackets already
  36.  1.22  18.11.96 : converted to english, C++ comments to C ones
  37.  1.23  02.01.97 : corrected some stuff
  38.  1.24  17.03.97 : removed GetChar and other obsolete defines
  39. */
  40.  
  41. #include <exec/types.h>
  42.  
  43. /* ======================= no need for <stdlib.h> ======================= */
  44.  
  45. extern void exit(int);
  46.  
  47. /* ============================ other macros ============================ */
  48.  
  49. /* <pragma/exec_lib.h>, <dos/dos.h> */
  50.  
  51. #define CTRL_C        (SetSignal(0L,0L) & SIGBREAKF_CTRL_C)
  52.  
  53. /* ======================= character definitions ======================== */
  54.  
  55. #define BS     8
  56. #define ESC    27
  57.  
  58. /* ================================= SAS C ============================== */
  59.  
  60. #ifdef __SASC
  61.   extern struct ExecBase    *SysBase;
  62.   extern struct DosLibrary    *DOSBase;
  63.   #include <dos/dosextens.h>
  64.  
  65.   #define TestOS if(DOSBase->dl_lib.lib_Version < DosVersion)    \
  66.              exit(RETURN_FAIL)
  67. #endif
  68.  
  69. /* A word about variable DosVersion: In my startup code for MaxonC++ I
  70. include use OpenLibrary("dos.library", DosVersion) instead of standard
  71. OpenLibrary("dos.library",0) call. If no DosVersion is given, this
  72. variable defaults to 33, else you can give the value by creating a global
  73. variable ULONG DosVersion = 37;. The program does not start, when the
  74. required dos is not available. (Better then others, which crash) */
  75.  
  76. /* ===================== version string and EndCode ===================== */
  77.  
  78. #ifndef NOCODE
  79.   extern STRPTR version;        /* Proto for Version */
  80.   extern void End(UBYTE);        /* Proto for End */
  81.  
  82.   #if !defined(NOVERSION) && defined(NAME)
  83.     #ifndef AUTHOR
  84.       #define AUTHOR "by SDI"
  85.     #endif
  86.     #ifndef VERSION
  87.       #define VERSION "1"
  88.     #endif
  89.     #ifndef REVISION
  90.       #define REVISION "0"
  91.     #endif
  92.     #ifndef DATE
  93.       #ifdef __MAXON__
  94.         #define DATE __DATE2__
  95.       #elif defined(__SASC)
  96.         #define DATE __AMIGADATE__
  97.       #endif
  98.     #endif
  99.     #ifdef __MAXON__
  100.       #define SDI_DATE "(" DATE ")"
  101.     #elif defined(__SASC)
  102.       #define SDI_DATE DATE
  103.     #endif
  104.  
  105.     #ifndef DISTRIBUTION
  106.       #define DISTRIBUTION "(PD) "
  107.     #endif
  108.     STRPTR version = (STRPTR) "$VER: " NAME " " VERSION "." REVISION " "
  109.     SDI_DATE " " DISTRIBUTION AUTHOR;
  110.  
  111.   #endif /* !NOVERSION && NAME */
  112.  
  113.   #if defined(ENDCODE) || defined(ENDCODE_NOCTRLC)
  114.     #ifdef __MAXON__
  115.       #define __inline
  116.       inline
  117.     #endif
  118.       void __inline end(void);
  119.     void End(UBYTE err)
  120.     {
  121.       #ifndef ENDCODE_NOCTRLC
  122.       if(CTRL_C)
  123.       {
  124.         err = RETURN_WARN;
  125.         SetIoErr(ERROR_BREAK);
  126.       }
  127.       #endif
  128.  
  129.       end();
  130.  
  131.       if(err)        PrintFault(IoErr(), 0);
  132.       exit(err);
  133.     }
  134.   #endif /* ENDCODE && ENDCODE_NOCTRLC */
  135. #endif /* NOCODE */
  136.  
  137. #endif /* SDI_DEFINES_H */
  138.  
  139.